import 'package:flutter/material.dart';
import 'package:get/get.dart';

class LangPage extends GetView {

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(title: Text('LangPage')),

      body: SafeArea(
        child: ListView(
          children: [
            Text(
              'Hello: '+'hello'.tr,
              style: Theme.of(context).textTheme.headline5
            ),
            Text(
              'logged_in: '+'logged_in'.trParams({
                'name': 'whoicliu',
                'email': 'whoicliu@163.com'
              }),
              style: Theme.of(context).textTheme.headline5
            ),
            Divider(),

            ListTile(
              title: Text('切换中文'),
              subtitle: Text('zh_CN'),
              onTap: () {
                var locale = Locale('zh', 'CN');
                Get.updateLocale(locale);
              }
            ),
            ListTile(
              title: Text('Change English'),
              subtitle: Text('en_US'),
              onTap: () {
                var locale = Locale('en', 'US');
                Get.updateLocale(locale);
              }
            ),
          ],
        )
      )
    );
  }
}